package com.xianyun.book.common.core.handle;


import java.util.List;

/**
 * @author macos-zyj
 */
public class HandleChain<T,Q> {
    private SingleInvoker<T,Q> singleHead;
    private MultipleInvoker<T,Q> multipleHead;

    public T doHandle(HandleParam<Q> handleParam){
        return singleHead.invoke(handleParam);
    }

    public List<T> doListHandle(HandleParam<Q> handleParam) {
        return multipleHead.invokeList(handleParam);
    }

    public void setHeader(SingleInvoker header) {
        this.singleHead = header;
    }

    public void setHeader(MultipleInvoker header) {
        this.multipleHead = header;
    }
}
